import request from "@/utils/request"

export interface trademarkItemType {
  id?: number
  tmName: string
  logoUrl: string
}

export type trademarkListType = trademarkItemType[]

export interface trademarkListReturnType {
  records: trademarkListType
  total: number
  size: number
  current: number
  searchCount: boolean
  pages: number
}

//1.请求品牌分页列表数据
export const reqTrademarkList = (page: number, limit: number) => {
  return request.get<null, trademarkListReturnType>(
    `/admin/product/baseTrademark/${page}/${limit}`
  )
}

//2.新增品牌的请求
export const reqAddTrademark = (tmInfo: trademarkItemType) => {
  return request.post<null, null>(`/admin/product/baseTrademark/save`, tmInfo)
}

//3.修改品牌的请求
export const reqUpdateTrademark = (tmInfo: trademarkItemType) => {
  return request.put<null, null>(`/admin/product/baseTrademark/update`, tmInfo)
}

//4.删除品牌的请求
export const reqDeleteTrademark = (id: number) => {
  return request.delete<null, null>(`/admin/product/baseTrademark/remove/${id}`)
}

//5.获取所有品牌列表的请求
export const reqAllTrademark = () => {
  return request.get<null, trademarkListType>(
    `/admin/product/baseTrademark/getTrademarkList`
  )
}
